-
Notifications
You must be signed in to change notification settings - Fork 58
chore: add check for navigator locks #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the typical cases where navigator.locks
is not available?
Could this cause other issues, such as multiple tabs syncing concurrently?
@rkistner based on this https://discord.com/channels/1138230179878154300/1291056749197131796 the general issue is an unsecure context being used (e.g. |
Ok, I wasn't aware of the secure context limitation. Is it feasible to limit this to only "safe" setups, such as when using a SharedWorker? I'm concerned that silent data corruption because of a lack of cross-tab locks could be even more difficult to debug. |
HI there, is this work complete? And if so do you have any idea when it will be released? I think I am in a situation where this would benefit me, I am building a nextjs application and then converting it to ios and android app using capacitor. Powersync seems to work well when the apps are bundled fully, but during the development process I am pointing to local host and using the nextjs instance that is running there, which enables hot reloading of my changes in xcode and android studio, this method doesn't work with powersync, I get an error that mentions navigator locks. Apologies if this is unrelated, but would be a massive help if your changes solve it! happy to test them on this use case if you can point me in the direction of a package with the changes implemented. |
This is released already, but it only checks that Even if we removed usage of the locks here, wa-sqlite still uses the same You say you're pointing to local host in development - is that |
@rkistner Thanks very much for the response, I will give that a try |
Description
Currently, apps do not work as expected when users use an insecure context (e.g. http://127.0.0.2) which results in confusing behaviour for users (e.g. https://discord.com/channels/1138230179878154300/1291056749197131796).
This PR adds a check to confirm that navigator locks are present and throws an error otherwise. This should avoid users experiencing the above mentioned issue.
This also includes vitest updates as they are required to avoid false positives see here (vitest-dev/vitest#6187)
Testing
I've added unit tests to confirm the behaviour